package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
@Mapper
public interface SysCompanyUserMapper extends BaseMapper<SysCompanyUser> {


    @Select("select * from sys_company_user where id = " +
            "(select company_user_id from  sys_company_user_role where " +
            "role_id = (select sr.id from sys_role sr where sr.role_name = 'ROLE_ADMIN_SYS' and sr.company_id =  #{companyId})" +
            "and company_id = #{companyId})")
    public SysCompanyUser queryCurrentAdmin(Long companyId);
}
